//
//  ZCInvolvedDetailsModelContent.m
//
//  Created by   on 16/3/28
//  Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//

#import "ZCInvolvedDetailsModelContent.h"
#import "ZCInvolvedDetailsModelHotComments.h"
#import "ZCInvolvedDetailsModelLatestSixSponsors.h"
#import "ZCInvolvedDetailsModelDetailThumbLists.h"
#import "ZCInvolvedDetailsModelHotSponsors.h"
#import "ZCInvolvedDetailsModelThumbList.h"


NSString *const kZCInvolvedDetailsModelContentCtime = @"ctime";
NSString *const kZCInvolvedDetailsModelContentEmoney = @"emoney";
NSString *const kZCInvolvedDetailsModelContentDetailThumb = @"detail_thumb";
NSString *const kZCInvolvedDetailsModelContentId = @"id";
NSString *const kZCInvolvedDetailsModelContentIsthirdparty = @"isthirdparty";
NSString *const kZCInvolvedDetailsModelContentCategory = @"category";
NSString *const kZCInvolvedDetailsModelContentHotComments = @"hot_comments";
NSString *const kZCInvolvedDetailsModelContentState = @"state";
NSString *const kZCInvolvedDetailsModelContentTestreportid = @"testreportid";
NSString *const kZCInvolvedDetailsModelContentIfcollection = @"ifcollection";
NSString *const kZCInvolvedDetailsModelContentRank = @"rank";
NSString *const kZCInvolvedDetailsModelContentSamples = @"samples";
NSString *const kZCInvolvedDetailsModelContentLocation = @"location";
NSString *const kZCInvolvedDetailsModelContentLogo = @"logo";
NSString *const kZCInvolvedDetailsModelContentThumb = @"thumb";
NSString *const kZCInvolvedDetailsModelContentBtime = @"btime";
NSString *const kZCInvolvedDetailsModelContentFirstCategoryid = @"first_categoryid";
NSString *const kZCInvolvedDetailsModelContentPackagename = @"packagename";
NSString *const kZCInvolvedDetailsModelContentBrand = @"brand";
NSString *const kZCInvolvedDetailsModelContentSampleid = @"sampleid";
NSString *const kZCInvolvedDetailsModelContentLatestSixSponsors = @"latest_six_sponsors";
NSString *const kZCInvolvedDetailsModelContentBatch = @"batch";
NSString *const kZCInvolvedDetailsModelContentCommentCount = @"comment_count";
NSString *const kZCInvolvedDetailsModelContentEtime = @"etime";
NSString *const kZCInvolvedDetailsModelContentSecondCategoryid = @"second_categoryid";
NSString *const kZCInvolvedDetailsModelContentPackageid = @"packageid";
NSString *const kZCInvolvedDetailsModelContentPjname = @"pjname";
NSString *const kZCInvolvedDetailsModelContentInstitutionid = @"institutionid";
NSString *const kZCInvolvedDetailsModelContentPdname = @"pdname";
NSString *const kZCInvolvedDetailsModelContentSamnum = @"samnum";
NSString *const kZCInvolvedDetailsModelContentResult = @"result";
NSString *const kZCInvolvedDetailsModelContentSmoney = @"smoney";
NSString *const kZCInvolvedDetailsModelContentContent = @"content";
NSString *const kZCInvolvedDetailsModelContentRawdata = @"rawdata";
NSString *const kZCInvolvedDetailsModelContentInstitution = @"institution";
NSString *const kZCInvolvedDetailsModelContentMid = @"mid";
NSString *const kZCInvolvedDetailsModelContentUsername = @"username";
NSString *const kZCInvolvedDetailsModelContentAvatar = @"avatar";
NSString *const kZCInvolvedDetailsModelContentTestreportDetail = @"testreport_detail";
NSString *const kZCInvolvedDetailsModelContentFinish = @"finish";
NSString *const kZCInvolvedDetailsModelContentDetailThumbLists = @"detail_thumb_lists";
NSString *const kZCInvolvedDetailsModelContentSponsorsCount = @"sponsors_count";
NSString *const kZCInvolvedDetailsModelContentWxMediaIds = @"wx_media_ids";
NSString *const kZCInvolvedDetailsModelContentCitycode = @"citycode";
NSString *const kZCInvolvedDetailsModelContentFromtype = @"fromtype";
NSString *const kZCInvolvedDetailsModelContentHotSponsors = @"hot_sponsors";
NSString *const kZCInvolvedDetailsModelContentMemberUploadImgs = @"member_upload_imgs";
NSString *const kZCInvolvedDetailsModelContentMiniThumb = @"mini_thumb";
NSString *const kZCInvolvedDetailsModelContentThumbList = @"thumb_list";
NSString *const kZCInvolvedDetailsModelContentPid = @"pid";

NSString *const kZCInvolvedDetailsModelContentTestreportJpg = @"testreport_jpg";


@interface ZCInvolvedDetailsModelContent ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation ZCInvolvedDetailsModelContent

@synthesize ctime = _ctime;
@synthesize emoney = _emoney;
@synthesize detailThumb = _detailThumb;
@synthesize contentIdentifier = _contentIdentifier;
@synthesize isthirdparty = _isthirdparty;
@synthesize category = _category;
@synthesize hotComments = _hotComments;
@synthesize state = _state;
@synthesize testreportid = _testreportid;
@synthesize ifcollection = _ifcollection;
@synthesize rank = _rank;
@synthesize samples = _samples;
@synthesize location = _location;
@synthesize logo = _logo;
@synthesize thumb = _thumb;
@synthesize btime = _btime;
@synthesize firstCategoryid = _firstCategoryid;
@synthesize packagename = _packagename;
@synthesize brand = _brand;
@synthesize sampleid = _sampleid;
@synthesize latestSixSponsors = _latestSixSponsors;
@synthesize batch = _batch;
@synthesize commentCount = _commentCount;
@synthesize etime = _etime;
@synthesize secondCategoryid = _secondCategoryid;
@synthesize packageid = _packageid;
@synthesize pjname = _pjname;
@synthesize institutionid = _institutionid;
@synthesize pdname = _pdname;
@synthesize samnum = _samnum;
@synthesize result = _result;
@synthesize smoney = _smoney;
@synthesize content = _content;
@synthesize rawdata = _rawdata;
@synthesize institution = _institution;
@synthesize mid = _mid;
@synthesize username = _username;
@synthesize avatar = _avatar;
@synthesize testreportDetail = _testreportDetail;
@synthesize finish = _finish;
@synthesize detailThumbLists = _detailThumbLists;
@synthesize sponsorsCount = _sponsorsCount;
@synthesize wxMediaIds = _wxMediaIds;
@synthesize citycode = _citycode;
@synthesize fromtype = _fromtype;
@synthesize hotSponsors = _hotSponsors;
@synthesize memberUploadImgs = _memberUploadImgs;
@synthesize miniThumb = _miniThumb;
@synthesize thumbList = _thumbList;
@synthesize pid = _pid;
@synthesize testreportJpg = _testreportJpg;


+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    
    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.ctime = [self objectOrNilForKey:kZCInvolvedDetailsModelContentCtime fromDictionary:dict];
            self.emoney = [[self objectOrNilForKey:kZCInvolvedDetailsModelContentEmoney fromDictionary:dict] doubleValue];
            self.detailThumb = [self objectOrNilForKey:kZCInvolvedDetailsModelContentDetailThumb fromDictionary:dict];
            self.contentIdentifier = [self objectOrNilForKey:kZCInvolvedDetailsModelContentId fromDictionary:dict];
            self.isthirdparty = [self objectOrNilForKey:kZCInvolvedDetailsModelContentIsthirdparty fromDictionary:dict];
            self.category = [self objectOrNilForKey:kZCInvolvedDetailsModelContentCategory fromDictionary:dict];
    NSObject *receivedZCInvolvedDetailsModelHotComments = [dict objectForKey:kZCInvolvedDetailsModelContentHotComments];
    NSMutableArray *parsedZCInvolvedDetailsModelHotComments = [NSMutableArray array];
    if ([receivedZCInvolvedDetailsModelHotComments isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedZCInvolvedDetailsModelHotComments) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedZCInvolvedDetailsModelHotComments addObject:[ZCInvolvedDetailsModelHotComments modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedZCInvolvedDetailsModelHotComments isKindOfClass:[NSDictionary class]]) {
       [parsedZCInvolvedDetailsModelHotComments addObject:[ZCInvolvedDetailsModelHotComments modelObjectWithDictionary:(NSDictionary *)receivedZCInvolvedDetailsModelHotComments]];
    }

    self.hotComments = [NSMutableArray arrayWithArray:parsedZCInvolvedDetailsModelHotComments];
            self.state = [self objectOrNilForKey:kZCInvolvedDetailsModelContentState fromDictionary:dict];
            self.testreportid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentTestreportid fromDictionary:dict];
            self.ifcollection = [[self objectOrNilForKey:kZCInvolvedDetailsModelContentIfcollection fromDictionary:dict] doubleValue];
            self.rank = [self objectOrNilForKey:kZCInvolvedDetailsModelContentRank fromDictionary:dict];
            self.samples = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSamples fromDictionary:dict];
            self.location = [self objectOrNilForKey:kZCInvolvedDetailsModelContentLocation fromDictionary:dict];
            self.logo = [self objectOrNilForKey:kZCInvolvedDetailsModelContentLogo fromDictionary:dict];
            self.thumb = [self objectOrNilForKey:kZCInvolvedDetailsModelContentThumb fromDictionary:dict];
            self.btime = [self objectOrNilForKey:kZCInvolvedDetailsModelContentBtime fromDictionary:dict];
            self.firstCategoryid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentFirstCategoryid fromDictionary:dict];
            self.packagename = [self objectOrNilForKey:kZCInvolvedDetailsModelContentPackagename fromDictionary:dict];
            self.brand = [self objectOrNilForKey:kZCInvolvedDetailsModelContentBrand fromDictionary:dict];
            self.sampleid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSampleid fromDictionary:dict];
    NSObject *receivedZCInvolvedDetailsModelLatestSixSponsors = [dict objectForKey:kZCInvolvedDetailsModelContentLatestSixSponsors];
    NSMutableArray *parsedZCInvolvedDetailsModelLatestSixSponsors = [NSMutableArray array];
    if ([receivedZCInvolvedDetailsModelLatestSixSponsors isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedZCInvolvedDetailsModelLatestSixSponsors) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedZCInvolvedDetailsModelLatestSixSponsors addObject:[ZCInvolvedDetailsModelLatestSixSponsors modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedZCInvolvedDetailsModelLatestSixSponsors isKindOfClass:[NSDictionary class]]) {
       [parsedZCInvolvedDetailsModelLatestSixSponsors addObject:[ZCInvolvedDetailsModelLatestSixSponsors modelObjectWithDictionary:(NSDictionary *)receivedZCInvolvedDetailsModelLatestSixSponsors]];
    }

    self.latestSixSponsors = [NSArray arrayWithArray:parsedZCInvolvedDetailsModelLatestSixSponsors];
            self.batch = [self objectOrNilForKey:kZCInvolvedDetailsModelContentBatch fromDictionary:dict];
            self.commentCount = [self objectOrNilForKey:kZCInvolvedDetailsModelContentCommentCount fromDictionary:dict];
            self.etime = [self objectOrNilForKey:kZCInvolvedDetailsModelContentEtime fromDictionary:dict];
            self.secondCategoryid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSecondCategoryid fromDictionary:dict];
            self.packageid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentPackageid fromDictionary:dict];
            self.pjname = [self objectOrNilForKey:kZCInvolvedDetailsModelContentPjname fromDictionary:dict];
            self.institutionid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentInstitutionid fromDictionary:dict];
            self.pdname = [self objectOrNilForKey:kZCInvolvedDetailsModelContentPdname fromDictionary:dict];
            self.samnum = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSamnum fromDictionary:dict];
            self.result = [self objectOrNilForKey:kZCInvolvedDetailsModelContentResult fromDictionary:dict];
            self.smoney = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSmoney fromDictionary:dict];
            self.content = [self objectOrNilForKey:kZCInvolvedDetailsModelContentContent fromDictionary:dict];
            self.rawdata = [self objectOrNilForKey:kZCInvolvedDetailsModelContentRawdata fromDictionary:dict];
            self.institution = [self objectOrNilForKey:kZCInvolvedDetailsModelContentInstitution fromDictionary:dict];
            self.mid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentMid fromDictionary:dict];
            self.username = [self objectOrNilForKey:kZCInvolvedDetailsModelContentUsername fromDictionary:dict];
            self.avatar = [self objectOrNilForKey:kZCInvolvedDetailsModelContentAvatar fromDictionary:dict];
            self.testreportDetail = [self objectOrNilForKey:kZCInvolvedDetailsModelContentTestreportDetail fromDictionary:dict];
            self.finish = [self objectOrNilForKey:kZCInvolvedDetailsModelContentFinish fromDictionary:dict];
    NSObject *receivedZCInvolvedDetailsModelDetailThumbLists = [dict objectForKey:kZCInvolvedDetailsModelContentDetailThumbLists];
    NSMutableArray *parsedZCInvolvedDetailsModelDetailThumbLists = [NSMutableArray array];
    if ([receivedZCInvolvedDetailsModelDetailThumbLists isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedZCInvolvedDetailsModelDetailThumbLists) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedZCInvolvedDetailsModelDetailThumbLists addObject:[ZCInvolvedDetailsModelDetailThumbLists modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedZCInvolvedDetailsModelDetailThumbLists isKindOfClass:[NSDictionary class]]) {
       [parsedZCInvolvedDetailsModelDetailThumbLists addObject:[ZCInvolvedDetailsModelDetailThumbLists modelObjectWithDictionary:(NSDictionary *)receivedZCInvolvedDetailsModelDetailThumbLists]];
    }

    self.detailThumbLists = [NSArray arrayWithArray:parsedZCInvolvedDetailsModelDetailThumbLists];
            self.sponsorsCount = [self objectOrNilForKey:kZCInvolvedDetailsModelContentSponsorsCount fromDictionary:dict];
            self.wxMediaIds = [self objectOrNilForKey:kZCInvolvedDetailsModelContentWxMediaIds fromDictionary:dict];
            self.citycode = [self objectOrNilForKey:kZCInvolvedDetailsModelContentCitycode fromDictionary:dict];
            self.fromtype = [self objectOrNilForKey:kZCInvolvedDetailsModelContentFromtype fromDictionary:dict];
    NSObject *receivedZCInvolvedDetailsModelHotSponsors = [dict objectForKey:kZCInvolvedDetailsModelContentHotSponsors];
    NSMutableArray *parsedZCInvolvedDetailsModelHotSponsors = [NSMutableArray array];
    if ([receivedZCInvolvedDetailsModelHotSponsors isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedZCInvolvedDetailsModelHotSponsors) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedZCInvolvedDetailsModelHotSponsors addObject:[ZCInvolvedDetailsModelHotSponsors modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedZCInvolvedDetailsModelHotSponsors isKindOfClass:[NSDictionary class]]) {
       [parsedZCInvolvedDetailsModelHotSponsors addObject:[ZCInvolvedDetailsModelHotSponsors modelObjectWithDictionary:(NSDictionary *)receivedZCInvolvedDetailsModelHotSponsors]];
    }

    self.hotSponsors = [NSArray arrayWithArray:parsedZCInvolvedDetailsModelHotSponsors];
            self.memberUploadImgs = [self objectOrNilForKey:kZCInvolvedDetailsModelContentMemberUploadImgs fromDictionary:dict];
            self.miniThumb = [self objectOrNilForKey:kZCInvolvedDetailsModelContentMiniThumb fromDictionary:dict];
    NSObject *receivedZCInvolvedDetailsModelThumbList = [dict objectForKey:kZCInvolvedDetailsModelContentThumbList];
    NSMutableArray *parsedZCInvolvedDetailsModelThumbList = [NSMutableArray array];
    if ([receivedZCInvolvedDetailsModelThumbList isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedZCInvolvedDetailsModelThumbList) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedZCInvolvedDetailsModelThumbList addObject:[ZCInvolvedDetailsModelThumbList modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedZCInvolvedDetailsModelThumbList isKindOfClass:[NSDictionary class]]) {
       [parsedZCInvolvedDetailsModelThumbList addObject:[ZCInvolvedDetailsModelThumbList modelObjectWithDictionary:(NSDictionary *)receivedZCInvolvedDetailsModelThumbList]];
    }

    self.thumbList = [NSArray arrayWithArray:parsedZCInvolvedDetailsModelThumbList];
            self.pid = [self objectOrNilForKey:kZCInvolvedDetailsModelContentPid fromDictionary:dict];

    }
    
    self.testreportJpg = [self objectOrNilForKey:kZCInvolvedDetailsModelContentTestreportJpg fromDictionary:dict];
    
    return self;
    
}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:self.ctime forKey:kZCInvolvedDetailsModelContentCtime];
    [mutableDict setValue:[NSNumber numberWithDouble:self.emoney] forKey:kZCInvolvedDetailsModelContentEmoney];
    [mutableDict setValue:self.detailThumb forKey:kZCInvolvedDetailsModelContentDetailThumb];
    [mutableDict setValue:self.contentIdentifier forKey:kZCInvolvedDetailsModelContentId];
    [mutableDict setValue:self.isthirdparty forKey:kZCInvolvedDetailsModelContentIsthirdparty];
    [mutableDict setValue:self.category forKey:kZCInvolvedDetailsModelContentCategory];
    NSMutableArray *tempArrayForHotComments = [NSMutableArray array];
    for (NSObject *subArrayObject in self.hotComments) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForHotComments addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForHotComments addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForHotComments] forKey:kZCInvolvedDetailsModelContentHotComments];
    [mutableDict setValue:self.state forKey:kZCInvolvedDetailsModelContentState];
    [mutableDict setValue:self.testreportid forKey:kZCInvolvedDetailsModelContentTestreportid];
    [mutableDict setValue:[NSNumber numberWithDouble:self.ifcollection] forKey:kZCInvolvedDetailsModelContentIfcollection];
    [mutableDict setValue:self.rank forKey:kZCInvolvedDetailsModelContentRank];
    NSMutableArray *tempArrayForSamples = [NSMutableArray array];
    for (NSObject *subArrayObject in self.samples) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForSamples addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForSamples addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForSamples] forKey:kZCInvolvedDetailsModelContentSamples];
    [mutableDict setValue:self.location forKey:kZCInvolvedDetailsModelContentLocation];
    [mutableDict setValue:self.logo forKey:kZCInvolvedDetailsModelContentLogo];
    [mutableDict setValue:self.thumb forKey:kZCInvolvedDetailsModelContentThumb];
    [mutableDict setValue:self.btime forKey:kZCInvolvedDetailsModelContentBtime];
    [mutableDict setValue:self.firstCategoryid forKey:kZCInvolvedDetailsModelContentFirstCategoryid];
    [mutableDict setValue:self.packagename forKey:kZCInvolvedDetailsModelContentPackagename];
    [mutableDict setValue:self.brand forKey:kZCInvolvedDetailsModelContentBrand];
    [mutableDict setValue:self.sampleid forKey:kZCInvolvedDetailsModelContentSampleid];
    NSMutableArray *tempArrayForLatestSixSponsors = [NSMutableArray array];
    for (NSObject *subArrayObject in self.latestSixSponsors) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForLatestSixSponsors addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForLatestSixSponsors addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForLatestSixSponsors] forKey:kZCInvolvedDetailsModelContentLatestSixSponsors];
    [mutableDict setValue:self.batch forKey:kZCInvolvedDetailsModelContentBatch];
    [mutableDict setValue:self.commentCount forKey:kZCInvolvedDetailsModelContentCommentCount];
    [mutableDict setValue:self.etime forKey:kZCInvolvedDetailsModelContentEtime];
    [mutableDict setValue:self.secondCategoryid forKey:kZCInvolvedDetailsModelContentSecondCategoryid];
    [mutableDict setValue:self.packageid forKey:kZCInvolvedDetailsModelContentPackageid];
    [mutableDict setValue:self.pjname forKey:kZCInvolvedDetailsModelContentPjname];
    [mutableDict setValue:self.institutionid forKey:kZCInvolvedDetailsModelContentInstitutionid];
    [mutableDict setValue:self.pdname forKey:kZCInvolvedDetailsModelContentPdname];
    [mutableDict setValue:self.samnum forKey:kZCInvolvedDetailsModelContentSamnum];
    [mutableDict setValue:self.result forKey:kZCInvolvedDetailsModelContentResult];
    [mutableDict setValue:self.smoney forKey:kZCInvolvedDetailsModelContentSmoney];
    [mutableDict setValue:self.content forKey:kZCInvolvedDetailsModelContentContent];
    [mutableDict setValue:self.rawdata forKey:kZCInvolvedDetailsModelContentRawdata];
    [mutableDict setValue:self.institution forKey:kZCInvolvedDetailsModelContentInstitution];
    [mutableDict setValue:self.mid forKey:kZCInvolvedDetailsModelContentMid];
    [mutableDict setValue:self.username forKey:kZCInvolvedDetailsModelContentUsername];
    [mutableDict setValue:self.avatar forKey:kZCInvolvedDetailsModelContentAvatar];
    [mutableDict setValue:self.testreportDetail forKey:kZCInvolvedDetailsModelContentTestreportDetail];
    [mutableDict setValue:self.finish forKey:kZCInvolvedDetailsModelContentFinish];
    
    
    
    NSMutableArray *tempArrayForDetailThumbLists = [NSMutableArray array];
    for (NSObject *subArrayObject in self.detailThumbLists) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForDetailThumbLists addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForDetailThumbLists addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForDetailThumbLists] forKey:kZCInvolvedDetailsModelContentDetailThumbLists];
    [mutableDict setValue:self.sponsorsCount forKey:kZCInvolvedDetailsModelContentSponsorsCount];
    [mutableDict setValue:self.wxMediaIds forKey:kZCInvolvedDetailsModelContentWxMediaIds];
    [mutableDict setValue:self.citycode forKey:kZCInvolvedDetailsModelContentCitycode];
    [mutableDict setValue:self.fromtype forKey:kZCInvolvedDetailsModelContentFromtype];
    NSMutableArray *tempArrayForHotSponsors = [NSMutableArray array];
    for (NSObject *subArrayObject in self.hotSponsors) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForHotSponsors addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForHotSponsors addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForHotSponsors] forKey:kZCInvolvedDetailsModelContentHotSponsors];
    [mutableDict setValue:self.memberUploadImgs forKey:kZCInvolvedDetailsModelContentMemberUploadImgs];
    [mutableDict setValue:self.miniThumb forKey:kZCInvolvedDetailsModelContentMiniThumb];
    NSMutableArray *tempArrayForThumbList = [NSMutableArray array];
    for (NSObject *subArrayObject in self.thumbList) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForThumbList addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForThumbList addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForThumbList] forKey:kZCInvolvedDetailsModelContentThumbList];
    [mutableDict setValue:self.pid forKey:kZCInvolvedDetailsModelContentPid];
    
    
    NSMutableArray *tempArrayForTestreportJpg = [NSMutableArray array];
    for (NSObject *subArrayObject in self.testreportJpg) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForTestreportJpg addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForTestreportJpg addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForTestreportJpg] forKey:kZCInvolvedDetailsModelContentTestreportJpg];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description 
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}


#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.ctime = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentCtime];
    self.emoney = [aDecoder decodeDoubleForKey:kZCInvolvedDetailsModelContentEmoney];
    self.detailThumb = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentDetailThumb];
    self.contentIdentifier = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentId];
    self.isthirdparty = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentIsthirdparty];
    self.category = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentCategory];
    self.hotComments = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentHotComments];
    self.state = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentState];
    self.testreportid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentTestreportid];
    self.ifcollection = [aDecoder decodeDoubleForKey:kZCInvolvedDetailsModelContentIfcollection];
    self.rank = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentRank];
    self.samples = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSamples];
    self.location = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentLocation];
    self.logo = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentLogo];
    self.thumb = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentThumb];
    self.btime = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentBtime];
    self.firstCategoryid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentFirstCategoryid];
    self.packagename = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentPackagename];
    self.brand = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentBrand];
    self.sampleid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSampleid];
    self.latestSixSponsors = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentLatestSixSponsors];
    self.batch = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentBatch];
    self.commentCount = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentCommentCount];
    self.etime = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentEtime];
    self.secondCategoryid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSecondCategoryid];
    self.packageid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentPackageid];
    self.pjname = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentPjname];
    self.institutionid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentInstitutionid];
    self.pdname = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentPdname];
    self.samnum = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSamnum];
    self.result = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentResult];
    self.smoney = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSmoney];
    self.content = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentContent];
    self.rawdata = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentRawdata];
    self.institution = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentInstitution];
    self.mid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentMid];
    self.username = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentUsername];
    self.avatar = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentAvatar];
    self.testreportDetail = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentTestreportDetail];
    self.finish = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentFinish];
    self.detailThumbLists = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentDetailThumbLists];
    self.sponsorsCount = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentSponsorsCount];
    self.wxMediaIds = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentWxMediaIds];
    self.citycode = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentCitycode];
    self.fromtype = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentFromtype];
    self.hotSponsors = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentHotSponsors];
    self.memberUploadImgs = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentMemberUploadImgs];
    self.miniThumb = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentMiniThumb];
    self.thumbList = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentThumbList];
    self.pid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentPid];
    
    self.testreportJpg = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelContentTestreportJpg];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeObject:_ctime forKey:kZCInvolvedDetailsModelContentCtime];
    [aCoder encodeDouble:_emoney forKey:kZCInvolvedDetailsModelContentEmoney];
    [aCoder encodeObject:_detailThumb forKey:kZCInvolvedDetailsModelContentDetailThumb];
    [aCoder encodeObject:_contentIdentifier forKey:kZCInvolvedDetailsModelContentId];
    [aCoder encodeObject:_isthirdparty forKey:kZCInvolvedDetailsModelContentIsthirdparty];
    [aCoder encodeObject:_category forKey:kZCInvolvedDetailsModelContentCategory];
    [aCoder encodeObject:_hotComments forKey:kZCInvolvedDetailsModelContentHotComments];
    [aCoder encodeObject:_state forKey:kZCInvolvedDetailsModelContentState];
    [aCoder encodeObject:_testreportid forKey:kZCInvolvedDetailsModelContentTestreportid];
    [aCoder encodeDouble:_ifcollection forKey:kZCInvolvedDetailsModelContentIfcollection];
    [aCoder encodeObject:_rank forKey:kZCInvolvedDetailsModelContentRank];
    [aCoder encodeObject:_samples forKey:kZCInvolvedDetailsModelContentSamples];
    [aCoder encodeObject:_location forKey:kZCInvolvedDetailsModelContentLocation];
    [aCoder encodeObject:_logo forKey:kZCInvolvedDetailsModelContentLogo];
    [aCoder encodeObject:_thumb forKey:kZCInvolvedDetailsModelContentThumb];
    [aCoder encodeObject:_btime forKey:kZCInvolvedDetailsModelContentBtime];
    [aCoder encodeObject:_firstCategoryid forKey:kZCInvolvedDetailsModelContentFirstCategoryid];
    [aCoder encodeObject:_packagename forKey:kZCInvolvedDetailsModelContentPackagename];
    [aCoder encodeObject:_brand forKey:kZCInvolvedDetailsModelContentBrand];
    [aCoder encodeObject:_sampleid forKey:kZCInvolvedDetailsModelContentSampleid];
    [aCoder encodeObject:_latestSixSponsors forKey:kZCInvolvedDetailsModelContentLatestSixSponsors];
    [aCoder encodeObject:_batch forKey:kZCInvolvedDetailsModelContentBatch];
    [aCoder encodeObject:_commentCount forKey:kZCInvolvedDetailsModelContentCommentCount];
    [aCoder encodeObject:_etime forKey:kZCInvolvedDetailsModelContentEtime];
    [aCoder encodeObject:_secondCategoryid forKey:kZCInvolvedDetailsModelContentSecondCategoryid];
    [aCoder encodeObject:_packageid forKey:kZCInvolvedDetailsModelContentPackageid];
    [aCoder encodeObject:_pjname forKey:kZCInvolvedDetailsModelContentPjname];
    [aCoder encodeObject:_institutionid forKey:kZCInvolvedDetailsModelContentInstitutionid];
    [aCoder encodeObject:_pdname forKey:kZCInvolvedDetailsModelContentPdname];
    [aCoder encodeObject:_samnum forKey:kZCInvolvedDetailsModelContentSamnum];
    [aCoder encodeObject:_result forKey:kZCInvolvedDetailsModelContentResult];
    [aCoder encodeObject:_smoney forKey:kZCInvolvedDetailsModelContentSmoney];
    [aCoder encodeObject:_content forKey:kZCInvolvedDetailsModelContentContent];
    [aCoder encodeObject:_rawdata forKey:kZCInvolvedDetailsModelContentRawdata];
    [aCoder encodeObject:_institution forKey:kZCInvolvedDetailsModelContentInstitution];
    [aCoder encodeObject:_mid forKey:kZCInvolvedDetailsModelContentMid];
    [aCoder encodeObject:_username forKey:kZCInvolvedDetailsModelContentUsername];
    [aCoder encodeObject:_avatar forKey:kZCInvolvedDetailsModelContentAvatar];
    [aCoder encodeObject:_testreportDetail forKey:kZCInvolvedDetailsModelContentTestreportDetail];
    [aCoder encodeObject:_finish forKey:kZCInvolvedDetailsModelContentFinish];
    [aCoder encodeObject:_detailThumbLists forKey:kZCInvolvedDetailsModelContentDetailThumbLists];
    [aCoder encodeObject:_sponsorsCount forKey:kZCInvolvedDetailsModelContentSponsorsCount];
    [aCoder encodeObject:_wxMediaIds forKey:kZCInvolvedDetailsModelContentWxMediaIds];
    [aCoder encodeObject:_citycode forKey:kZCInvolvedDetailsModelContentCitycode];
    [aCoder encodeObject:_fromtype forKey:kZCInvolvedDetailsModelContentFromtype];
    [aCoder encodeObject:_hotSponsors forKey:kZCInvolvedDetailsModelContentHotSponsors];
    [aCoder encodeObject:_memberUploadImgs forKey:kZCInvolvedDetailsModelContentMemberUploadImgs];
    [aCoder encodeObject:_miniThumb forKey:kZCInvolvedDetailsModelContentMiniThumb];
    [aCoder encodeObject:_thumbList forKey:kZCInvolvedDetailsModelContentThumbList];
    [aCoder encodeObject:_pid forKey:kZCInvolvedDetailsModelContentPid];
    
    [aCoder encodeObject:_testreportJpg forKey:kZCInvolvedDetailsModelContentTestreportJpg];
}

- (id)copyWithZone:(NSZone *)zone
{
    ZCInvolvedDetailsModelContent *copy = [[ZCInvolvedDetailsModelContent alloc] init];
    
    if (copy) {

        copy.ctime = [self.ctime copyWithZone:zone];
        copy.emoney = self.emoney;
        copy.detailThumb = [self.detailThumb copyWithZone:zone];
        copy.contentIdentifier = [self.contentIdentifier copyWithZone:zone];
        copy.isthirdparty = [self.isthirdparty copyWithZone:zone];
        copy.category = [self.category copyWithZone:zone];
        copy.hotComments = [self.hotComments copyWithZone:zone];
        copy.state = [self.state copyWithZone:zone];
        copy.testreportid = [self.testreportid copyWithZone:zone];
        copy.ifcollection = self.ifcollection;
        copy.rank = [self.rank copyWithZone:zone];
        copy.samples = [self.samples copyWithZone:zone];
        copy.location = [self.location copyWithZone:zone];
        copy.logo = [self.logo copyWithZone:zone];
        copy.thumb = [self.thumb copyWithZone:zone];
        copy.btime = [self.btime copyWithZone:zone];
        copy.firstCategoryid = [self.firstCategoryid copyWithZone:zone];
        copy.packagename = [self.packagename copyWithZone:zone];
        copy.brand = [self.brand copyWithZone:zone];
        copy.sampleid = [self.sampleid copyWithZone:zone];
        copy.latestSixSponsors = [self.latestSixSponsors copyWithZone:zone];
        copy.batch = [self.batch copyWithZone:zone];
        copy.commentCount = [self.commentCount copyWithZone:zone];
        copy.etime = [self.etime copyWithZone:zone];
        copy.secondCategoryid = [self.secondCategoryid copyWithZone:zone];
        copy.packageid = [self.packageid copyWithZone:zone];
        copy.pjname = [self.pjname copyWithZone:zone];
        copy.institutionid = [self.institutionid copyWithZone:zone];
        copy.pdname = [self.pdname copyWithZone:zone];
        copy.samnum = [self.samnum copyWithZone:zone];
        copy.result = [self.result copyWithZone:zone];
        copy.smoney = [self.smoney copyWithZone:zone];
        copy.content = [self.content copyWithZone:zone];
        copy.rawdata = [self.rawdata copyWithZone:zone];
        copy.institution = [self.institution copyWithZone:zone];
        copy.mid = [self.mid copyWithZone:zone];
        copy.username = [self.username copyWithZone:zone];
        copy.avatar = [self.avatar copyWithZone:zone];
        copy.testreportDetail = [self.testreportDetail copyWithZone:zone];
        copy.finish = [self.finish copyWithZone:zone];
        copy.detailThumbLists = [self.detailThumbLists copyWithZone:zone];
        copy.sponsorsCount = [self.sponsorsCount copyWithZone:zone];
        copy.wxMediaIds = [self.wxMediaIds copyWithZone:zone];
        copy.citycode = [self.citycode copyWithZone:zone];
        copy.fromtype = [self.fromtype copyWithZone:zone];
        copy.hotSponsors = [self.hotSponsors copyWithZone:zone];
        copy.memberUploadImgs = [self.memberUploadImgs copyWithZone:zone];
        copy.miniThumb = [self.miniThumb copyWithZone:zone];
        copy.thumbList = [self.thumbList copyWithZone:zone];
        copy.pid = [self.pid copyWithZone:zone];
        
        copy.testreportJpg = [self.testreportJpg copyWithZone:zone];
    }
    
    return copy;
}


@end
